﻿// Public Class FileServices
// #Region "变量"
// Public Shared ReadOnly Property Items As Dictionary(Of String, BaseFileService)
// Get
// If FileServices.m_Items Is Nothing Then
// FileServices.m_Items = New Dictionary(Of String, BaseFileService)
// Marmat.Data.Configuration.SetConfiguration(Nothing, Nothing)
// End If
// Return FileServices.m_Items
// End Get
// End Property
// Friend Shared m_Items As Dictionary(Of String, BaseFileService)
// #End Region

// #Region "属性"
// ''' <summary>
// ''' 返回一个数据源
// ''' </summary>
// ''' <param name="ConnectionName">数据源名称</param>
// ''' <value></value>
// ''' <returns></returns>
// ''' <remarks></remarks>
// Public Shared ReadOnly Property Item(ByVal ConnectionName As String) As BaseFileService
// Get
// If ConnectionName > "" Then
// If Connections.Items.ContainsKey(ConnectionName) Then
// Dim Connection As BaseFileService = FileServices.Items(ConnectionName)
// Return Connection
// End If
// End If
// Return Nothing
// End Get
// End Property

// ''' <summary>
// ''' 返回一个数据源
// ''' </summary>
// ''' <param name="index"></param>
// ''' <value></value>
// ''' <returns></returns>
// ''' <remarks></remarks>
// Public Shared ReadOnly Property Item(ByVal index As Integer) As BaseFileService
// Get
// Dim int As Integer = 0
// For Each Key As String In FileServices.Items.Keys
// If index = int Then
// Return FileServices.Item(Key)
// End If
// int = 1
// Next
// Return Nothing
// End Get
// End Property

// ''' <summary>
// ''' 返回数据源的数量
// ''' </summary>
// ''' <value></value>
// ''' <returns></returns>
// ''' <remarks></remarks>
// Public Shared ReadOnly Property Count As Integer
// Get
// Return FileServices.Items.Count
// End Get
// End Property

// Public Shared Property [Default] As BaseFileService
// Get
// If FileServices.m_Default Is Nothing AndAlso Connections.Count > 0 Then
// Return FileServices.Item(0)
// End If
// Return FileServices.m_Default
// End Get
// Set(value As BaseFileService)
// FileServices.m_Default = value
// End Set
// End Property
// Private Shared m_Default As BaseConnection
// #End Region

// #Region "方法"
// Public Shared Function Contains(ByVal ConnectionName As String) As Boolean
// Return FileServices.Items.ContainsKey(ConnectionName)
// End Function

// Public Shared Function Add(ByVal ConnectionName As String, ByVal ConnectionString As String, ByVal SourceType As SourceType) As BaseConnection
// If ConnectionName > "" Then
// If Connections.Items.ContainsKey(ConnectionName) Then
// Throw New Exception("系统已存在名为""" & ConnectionName & """的数据源,因此添加失败!")
// Else
// Dim Connection As New Connection(ConnectionString, SourceType)
// Connection.Name = ConnectionName
// Connections.Items.Add(ConnectionName, Connection)
// End If
// Return Connections.Items(ConnectionName)
// Else
// Throw New Exception("数据源名称不能为空。")
// End If
// End Function

// Public Shared Sub Delete(ByVal Name As String)
// If Connections.Items.ContainsKey(Name) Then
// Connections.Items.Remove(Name)
// Else
// Throw New Exception("系统未找到名为""" & Name & """的数据源,因此删除失败!")
// End If
// End Sub
// #End Region
// End Class
// Public Class FileServices
// #Region "变量"
// Public Shared ReadOnly Property Items As Dictionary(Of String, BaseFileService)
// Get
// If FileServices.m_Items Is Nothing Then
// FileServices.m_Items = New Dictionary(Of String, BaseFileService)
// Marmat.Data.Configuration.SetConfiguration(Nothing, Nothing)
// End If
// Return FileServices.m_Items
// End Get
// End Property
// Friend Shared m_Items As Dictionary(Of String, BaseFileService)
// #End Region

// #Region "属性"
// ''' <summary>
// ''' 返回一个数据源
// ''' </summary>
// ''' <param name="ConnectionName">数据源名称</param>
// ''' <value></value>
// ''' <returns></returns>
// ''' <remarks></remarks>
// Public Shared ReadOnly Property Item(ByVal ConnectionName As String) As BaseFileService
// Get
// If ConnectionName > "" Then
// If Connections.Items.ContainsKey(ConnectionName) Then
// Dim Connection As BaseFileService = FileServices.Items(ConnectionName)
// Return Connection
// End If
// End If
// Return Nothing
// End Get
// End Property

// ''' <summary>
// ''' 返回一个数据源
// ''' </summary>
// ''' <param name="index"></param>
// ''' <value></value>
// ''' <returns></returns>
// ''' <remarks></remarks>
// Public Shared ReadOnly Property Item(ByVal index As Integer) As BaseFileService
// Get
// Dim int As Integer = 0
// For Each Key As String In FileServices.Items.Keys
// If index = int Then
// Return FileServices.Item(Key)
// End If
// int = 1
// Next
// Return Nothing
// End Get
// End Property

// ''' <summary>
// ''' 返回数据源的数量
// ''' </summary>
// ''' <value></value>
// ''' <returns></returns>
// ''' <remarks></remarks>
// Public Shared ReadOnly Property Count As Integer
// Get
// Return FileServices.Items.Count
// End Get
// End Property

// Public Shared Property [Default] As BaseFileService
// Get
// If FileServices.m_Default Is Nothing AndAlso Connections.Count > 0 Then
// Return FileServices.Item(0)
// End If
// Return FileServices.m_Default
// End Get
// Set(value As BaseFileService)
// FileServices.m_Default = value
// End Set
// End Property
// Private Shared m_Default As BaseConnection
// #End Region

// #Region "方法"
// Public Shared Function Contains(ByVal ConnectionName As String) As Boolean
// Return FileServices.Items.ContainsKey(ConnectionName)
// End Function

// Public Shared Function Add(ByVal ConnectionName As String, ByVal ConnectionString As String, ByVal SourceType As SourceType) As BaseConnection
// If ConnectionName > "" Then
// If Connections.Items.ContainsKey(ConnectionName) Then
// Throw New Exception("系统已存在名为""" & ConnectionName & """的数据源,因此添加失败!")
// Else
// Dim Connection As New Connection(ConnectionString, SourceType)
// Connection.Name = ConnectionName
// Connections.Items.Add(ConnectionName, Connection)
// End If
// Return Connections.Items(ConnectionName)
// Else
// Throw New Exception("数据源名称不能为空。")
// End If
// End Function

// Public Shared Sub Delete(ByVal Name As String)
// If Connections.Items.ContainsKey(Name) Then
// Connections.Items.Remove(Name)
// Else
// Throw New Exception("系统未找到名为""" & Name & """的数据源,因此删除失败!")
// End If
// End Sub
// #End Region
// End Class
